SQL and NoSQL Interview Questions by Vishwanathan Narayanan
Author: Vishwanathan Narayanan [Narayanan, Vishwanathan] , Date: February 5, 2024
, Views: 226
Command
Explanation
db.emp.find({name:{$regex:âVishwaâ}})
Search for a document containing Vishwa.
db.emp.find({name:{$regex:/Vishwa/}})
Search for a document containing Vishwa.
db.emp.find({name:{$regex:/Vishwa/}},$options:â$iâ)
Search for a document containing Vishwa with a case-insensitive nature.
db.emp.find({holidays:{$regex:âsunâ}})
Search for a document where the holidays array contains the word sun.
db.emp.find({name:{$regex: /^Vi/ }})
Search for a document where the name starts with Vi.
Copyright Disclaimer:
This site does not store any files on its server. We only index and link
to content provided by other sites. Please contact the content providers
to delete copyright contents if any and email us, we'll remove relevant
links or contents immediately.